package com.neo.subscribe.stamp.service;

import com.neo.subscribe.common.util.OkHttpUtils;
import com.neo.subscribe.stamp.entity.InterfaceConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Map;

@Slf4j
@Service
public class StampPageDataRequestProcess extends AbstractRequestProcess {

    @Override
    public String process(InterfaceConfig config) {
        Map<String, Object> requestHeaders = jsonToMap(config.getRequestHeader());
        Map<String, Object> requestBody = jsonToMap(config.getRequestBody());
        Map<String, Object> queryParams = jsonToMap(config.getQueryParam());
        return OkHttpUtils.request(config.getUrl(), requestHeaders, requestBody, queryParams, 10L, 10L);
    }
}
